/**
 * 
 * 广州锐鹏计算机科技有限公司（www.ruipengkj.com）
 * 
 * 
 * Copyright (c) 2011-2012 RUIPENGKJ.Co.Ltd. All rights reserved.
 * 
 * */
package com.ruipengkj.service.impl;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import com.ruipengkj.bean.ViewCommodityOrderSummary;
import com.ruipengkj.commons.base.query.BaseQuery;
import com.ruipengkj.commons.base.query.PageModel;
import com.ruipengkj.dao.ViewCommodityOrderSummaryDao;
import com.ruipengkj.service.ViewCommodityOrderSummaryService;
/**
 * 说明：
 * 商品销售汇总表Service层接口实现
 * @Author：李智深
 * @Date：2012-03-16
 */
@Service
public class ViewCommodityOrderSummaryServiceImpl implements ViewCommodityOrderSummaryService{

	@Resource
	private ViewCommodityOrderSummaryDao ViewCommodityOrderSummary;//DAO层

	@Override
	public void deleteService(String id) throws Exception {
		// TODO Auto-generated method stub
		
	}

	@Override
	public List<ViewCommodityOrderSummary> findService(
			ViewCommodityOrderSummary entity) throws Exception {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public ViewCommodityOrderSummary getByIdService(String id)
			throws Exception {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public PageModel<ViewCommodityOrderSummary> getScrollService(
			int firstResult, int maxResult, ViewCommodityOrderSummary entity)
			throws Exception {
		String hql = "select o from ViewCommodityOrderSummary o";
		StringBuffer whereHQL = new StringBuffer();
		List<Object> param = new ArrayList<Object>();
		if (entity != null) {
			if(entity.getCommodityName()!=null&&!entity.getCommodityName().equals("")){
				whereHQL.append("commodityName").append(BaseQuery.LIKE).append("?").append(BaseQuery.AND);
				param.add("%"+entity.getCommodityName()+"%");
			}
			if(whereHQL.length()>4)
				whereHQL.delete(whereHQL.length()-5, whereHQL.length());
		}
		LinkedHashMap<String, String> orderby = new LinkedHashMap<String, String>();
		return ViewCommodityOrderSummary.getScrollDao(hql, whereHQL.toString(), param, firstResult, maxResult, orderby);
	}

	@Override
	public void modifyService(ViewCommodityOrderSummary entity)
			throws Exception {
		// TODO Auto-generated method stub
		
	}

	@Override
	public void saveOrUpdateService(ViewCommodityOrderSummary entity)
			throws Exception {
		// TODO Auto-generated method stub
		
	}

	@Override
	public Serializable saveRetService(ViewCommodityOrderSummary entity)
			throws Exception {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public void saveService(ViewCommodityOrderSummary entity)
			throws Exception {
		// TODO Auto-generated method stub
		
	}

	public ViewCommodityOrderSummaryDao getViewCommodityOrderSummary() {
		return ViewCommodityOrderSummary;
	}

	public void setViewCommodityOrderSummary(
			ViewCommodityOrderSummaryDao ViewCommodityOrderSummary) {
		this.ViewCommodityOrderSummary = ViewCommodityOrderSummary;
	}
	
	@Override
	public List<ViewCommodityOrderSummary> findExportService(
			ViewCommodityOrderSummary entity) throws Exception {
		String hql = "select o from ViewCommodityOrderSummary o";
		StringBuffer whereHQL = new StringBuffer();
		List<Object> param = new ArrayList<Object>();
		if (entity != null) {
			if(entity.getCommodityName()!=null&&!entity.getCommodityName().equals("")){
				whereHQL.append("commodityName").append(BaseQuery.LIKE).append("?").append(BaseQuery.AND);
				param.add("%"+entity.getCommodityName()+"%");
			}
			if(whereHQL.length()>4)
				whereHQL.delete(whereHQL.length()-5, whereHQL.length());
		}
		LinkedHashMap<String, String> orderby = new LinkedHashMap<String, String>();
		return ViewCommodityOrderSummary.findDao(hql, whereHQL.toString(), param, orderby);
	}
}
